import { Component, Input, OnInit, Output, EventEmitter, ViewChild, ElementRef } from '@angular/core';
import { todo } from '../../app.component';

@Component({
  selector: 'app-show-list',
  templateUrl: './show-list.component.html',
  styles: [
  ]
})

export class ShowListComponent implements OnInit {

  @Input('list') list: todo[] = []
  @Output() deleteItem = new EventEmitter()
  constructor() { }

  ngOnInit(): void {
  }

  identify(index: number, item: todo) {
    return item.id
  }

  delete(id: string, checked: boolean) {
    if (checked) {
      this.deleteItem.emit(parseInt(id));
    }
  }

}
